package com.inspur.ssm.controller;


import java.util.List;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;


import com.inspur.ssm.pojo.NewsBean;
import com.inspur.ssm.service.NewsService;


/**
 * 登录控制器
 * @author administrator
 *
 */
@Controller
public class NewsController {
	@Autowired
	private NewsService newsService;
	
	//取得课程一览信息
	@RequestMapping("/toShowNewsList")
	public String newslist(Model model) throws Exception{	
		List<NewsBean> newsList = newsService.getNewsList();
		model.addAttribute("newsList",newsList);
		return "ShowNewsList";
	}
	
	@RequestMapping("/toShowNews")
	public String toinsertCourse(String id,Model model) throws Exception{
		NewsBean newsBean =newsService.getNews(id);
		model.addAttribute("newsBean",newsBean);
		return "ShowNews";
	}
	
	
	
}
